package com.example.demo1.user.dao.impl;

import com.example.demo1.user.dao.IUserDao;
import com.example.demo1.utils.JdbcUtils;

import java.sql.Connection;
import java.util.List;

public class UserDaoImpl implements IUserDao {
    JdbcUtils jdbcUtils = JdbcUtils.getInstance();

    // 处理jdbc与数据库之间的交互
    @Override
    public List getDataList(Connection conn, String sql, Object... params) {
        return jdbcUtils.getDataList(jdbcUtils.getConnection(), sql, params);
    }

    @Override
    public Integer saveData(String sql, Object... params) {
        System.out.println("params:" + params.length);
        return jdbcUtils.saveData(jdbcUtils.getConnection(), sql, params);
    }
}
